package org.cs.mgr.before.dao.impl;

import java.util.List;
import java.util.Map;

import org.cs.core.dao.impl.BaseDao;
import org.cs.mgr.before.dao.IExcellentSelectorDao;
import org.cs.mgr.before.model.ExcellentSelector;
import org.cs.mgr.before.model.Goods;
import org.springframework.stereotype.Repository;
@Repository
public class ExcellentSelectorDao extends BaseDao<ExcellentSelector> implements IExcellentSelectorDao{
	//通过goods_id,查询excellent_selector表(优选师表)
	@Override
	public  List<Map<String, Object>> getExcellentSelectorOne(String id) {
     List<Map<String, Object>> excellentSelectorOne = this.findBySql("SELECT * from excellentselector where GOODS_ID="+id);
		return excellentSelectorOne;
	}
	//通过excellent_selector表的ID,查excellent_selector_recommend表和goods表，返回list
	@Override
	public List<Map<String, Object>> getRecommendGoods(String id) {
		List<Map<String, Object>> recommendGoods = this.findBySql("SELECT esr.RECOMMENDED_CONTENT,esr.RECOMMENDED_TIME, g.GOOD_PICTURE_URL,g.GOOD_NAME,g.PEOPLE_NUMBER  FROM `excellent_selector_recommend` esr LEFT JOIN goods AS g   on esr.GOODs_ID=g.ID WHERE esr.E_SID="+id);	
		return recommendGoods;
	}

}
